import os

from faker import Faker
from utils.excel import BaseExcel
from MergeExcel.core import multiple_excel_merge_multiple_sheet
fk = Faker(locale="zh-CN")
titles = ["班级", "序号", "姓名", "性别", "手机号", "出生日期", "身份证号", "邮箱", "家庭地址", "备注"]
"""生成多个Excel文件"""
for excel_index in range(3):    # 生成3个excel文件
    e = BaseExcel()
    e.title = titles
    for row_index in range(fk.random_int(5,10)):     # 随机5~10行数据
        e.append([
            "高一{}班".format(excel_index+1),
            row_index+1,
            fk.name(),
            fk.random_element(["男", "女"]),
            fk.phone_number(),
            fk.date_between(start_date="-20y", end_date="-15y"),
            fk.ssn(min_age=15, max_age=20),
            fk.email(),
            fk.address(),
            fk.text(max_nb_chars=20)
        ])
        # e.save(r"高一{}班学生信息表.xlsx".format(excel_index+1))
"""生成多工作表的单Excel文件"""
multiple_excel_merge_multiple_sheet(os.getcwd(),"文件数字","升序").save("../高一年级学生信息总表.xlsx")

